import React, { Component } from 'react'
import { withRouter, Redirect } from 'react-router-dom'
import './css/PageBtn.less'
import './css/SubmitBtn.less'

class PageBtn extends Component {

    constructor(props) {
        super(props)
        this.state = {
        }
    }

    componentDidMount() {
    }

    componentWillReceiveProps() {
    }


    render() {
        var { params } = this.props
        // console.log(params)
        return (
            <div className="PageBtn">
                {
                    params.type === 'bottomBtn' ? <div className="bottomFixedBtnBox">
                        <button className="bottomFixedBtn">{params.title}</button>
                        <button className="bottomFixedBtn bottom" onClick={this.btnClick}>{params.title}</button>
                    </div> : ''
                }

                {
                    params.type === 'submitBtn' ? <div style={{ marginTop: params.marTop ? params.marTop : '1.4rem' }} className="submitBtnBox">
                        <button style={{ backgroundColor: params.bgColor ? params.bgColor : '#FF0844', width: params.width ? params.width : "11.5rem" }} className="submitBtn" onClick={this.btnClick}>{params.title}</button>
                    </div> : ''
                }
            </div>
        )
    }


    btnClick = () => {
        if (this.props.params.onClick) {
            this.props.params.onClick()
        }
    }
}

export default withRouter(PageBtn)
